﻿using com.fmtx.IDal;
using fmtx.Framework.DALFactory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace website.Areas.Action.Controllers
{
    public class UserController : Controller
    {
        //
        // GET: /Action/User/

        private IUserInfo userinfo = DataAccess<IUserInfo>.GetObject();

        /// <summary>
        /// 判断用户名是否已经被注册
        /// </summary>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public ActionResult IsExsts(string UserName)
        {
            if (UserName.IsUnameDirt())
            {
                return Json("包含非法字符！", JsonRequestBehavior.AllowGet);
            }
            else
            {
                var has = userinfo.IsExsts(UserName);
                return Json(!has, JsonRequestBehavior.AllowGet);
            }
        }

        /// <summary>
        /// 判断用户名是否已经被注册
        /// </summary>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public ActionResult IsMailExsts(string Email)
        {
            var has = userinfo.IsExsts(Email);
            return Json(!has, JsonRequestBehavior.AllowGet);
        }

    }
}
